$(function(){
	$(".total-score-btn").click(function(){
		var parent = $(this).parent().parent();
		var contestId = $("#contestId").val();
		var seasonId = $("#seasonId").val();
		var type = $("#type").val();
		var teamId = parent.find("[name='teamId']").val();
		var teamFirstSectionScore = parent.find("[name='team-firstSectionScore']").val();
		var teamSecondSectionScore = parent.find("[name='team-secondSectionScore']").val();
		var teamThirdSectionScore = parent.find("[name='team-thirdSectionScore']").val();
		var teamFourthSectionScore = parent.find("[name='team-fourthSectionScore']").val();
		var teamOvertimeOneScore = parent.find("[name='team-overtimeOneScore']").val();
		var teamOvertimeTwoScore = parent.find("[name='team-overtimeTwoScore']").val();
		var teamOvertimeThreeScore = parent.find("[name='team-overtimeThreeScore']").val();
		var teamOvertimeFourScore = parent.find("[name='team-overtimeFourScore']").val();
		
		var teamTwoId = parent.find("[name='teamTwoId']").val();
		var teamTwoFirstSectionScore = parent.find("[name='teamTwo-firstSectionScore']").val();
		var teamTwoSecondSectionScore = parent.find("[name='teamTwo-secondSectionScore']").val();
		var teamTwoThirdSectionScore = parent.find("[name='teamTwo-thirdSectionScore']").val();
		var teamTwoFourthSectionScore = parent.find("[name='teamTwo-fourthSectionScore']").val();
		var teamTwoOvertimeOneScore = parent.find("[name='teamTwo-overtimeOneScore']").val();
		var teamTwoOvertimeTwoScore = parent.find("[name='teamTwo-overtimeTwoScore']").val();
		var teamTwoOvertimeThreeScore = parent.find("[name='teamTwo-overtimeThreeScore']").val();
		var teamTwoOvertimeFourScore = parent.find("[name='teamTwo-overtimeFourScore']").val();
		
		var teamTotalScore = parseInt(teamFirstSectionScore)+parseInt(teamSecondSectionScore)
							+parseInt(teamThirdSectionScore)+parseInt(teamFourthSectionScore);
		var teamTwoTotalScore = parseInt(teamTwoFirstSectionScore)+parseInt(teamTwoSecondSectionScore)
							+parseInt(teamTwoThirdSectionScore)+parseInt(teamTwoFourthSectionScore);
		if(teamFirstSectionScore == null || teamFirstSectionScore == ''
			|| teamTwoFirstSectionScore == null || teamTwoFirstSectionScore == ''){
			alert("请填写第一节分数");
			return;
		}else if(isNaN(teamFirstSectionScore) || isNaN(teamTwoFirstSectionScore)){
			alert("第一节分数只能为数字");
			return;
		}
		if(teamSecondSectionScore == null || teamSecondSectionScore == ''
			|| teamTwoSecondSectionScore == null || teamTwoSecondSectionScore == ''){
			alert("请填写第二节分数");
			return;
		}else if(isNaN(teamSecondSectionScore) || isNaN(teamTwoSecondSectionScore)){
			alert("第二节分数只能为数字");
			return;
		}
		if(teamThirdSectionScore == null || teamThirdSectionScore == ''
			|| teamTwoThirdSectionScore == null || teamTwoThirdSectionScore == ''){
			alert("请填写第三节分数");
			return;
		}else if(isNaN(teamThirdSectionScore) || isNaN(teamTwoThirdSectionScore)){
			alert("第三节分数只能为数字");
			return;
		}
		if(teamFourthSectionScore == null || teamFourthSectionScore == ''
			|| teamTwoFourthSectionScore == null || teamTwoFourthSectionScore == ''){
			alert("请填写第四节分数");
			return;
		}else if(isNaN(teamFourthSectionScore) || isNaN(teamTwoFourthSectionScore)){
			alert("第四节分数只能为数字");
			return;
		}
		var data = "contestId="+contestId+"&seasonId="+seasonId+"&type="+type+
					"&teamId="+teamId+"&teamFirstSectionScore="+teamFirstSectionScore+
					"&teamSecondSectionScore="+teamSecondSectionScore+"&teamThirdSectionScore="+teamThirdSectionScore+
					"&teamFourthSectionScore="+teamFourthSectionScore+
					"&teamTwoId="+teamTwoId+"&teamTwoFirstSectionScore="+teamTwoFirstSectionScore+
					"&teamTwoSecondSectionScore="+teamTwoSecondSectionScore+"&teamTwoThirdSectionScore="+teamTwoThirdSectionScore+
					"&teamTwoFourthSectionScore="+teamTwoFourthSectionScore;
		if(teamOvertimeOneScore != null && teamOvertimeOneScore != '' && teamOvertimeOneScore != undefined){
			if(teamTwoOvertimeOneScore == null || teamTwoOvertimeOneScore == '' || teamTwoOvertimeOneScore == undefined){
				alert("加时赛数据不一致");
				return;
			}
			if(isNaN(teamOvertimeOneScore)){
				alert("输入有误");
				return;
			}
			data += "&teamOvertimeOneScore="+teamOvertimeOneScore;
			teamTotalScore += parseInt(teamOvertimeOneScore);
		}
		if(teamOvertimeTwoScore != null && teamOvertimeTwoScore != '' && teamOvertimeTwoScore != undefined){
			if(teamTwoOvertimeTwoScore == null || teamTwoOvertimeTwoScore == '' || teamTwoOvertimeTwoScore == undefined){
				alert("加时赛数据不一致");
				return;
			}
			if(isNaN(teamOvertimeTwoScore)){
				alert("输入有误");
				return;
			}
			data += "&teamOvertimeTwoScore="+teamOvertimeTwoScore;
			teamTotalScore += parseInt(teamOvertimeTwoScore);
		}
		if(teamOvertimeThreeScore != null && teamOvertimeThreeScore != '' && teamOvertimeThreeScore != undefined){
			if(teamTwoOvertimeThreeScore == null || teamTwoOvertimeThreeScore == '' || teamTwoOvertimeThreeScore == undefined){
				alert("加时赛数据不一致");
				return;
			}
			if(isNaN(teamOvertimeThreeScore)){
				alert("输入有误");
				return;
			}
			data += "&teamOvertimeThreeScore="+teamOvertimeThreeScore;
			teamTotalScore += parseInt(teamOvertimeThreeScore);
		}
		if(teamOvertimeFourScore != null && teamOvertimeFourScore != '' && teamOvertimeFourScore != undefined){
			if(teamTwoOvertimeFourScore == null || teamTwoOvertimeFourScore == '' || teamTwoOvertimeFourScore == undefined){
				alert("加时赛数据不一致");
				return;
			}
			if(isNaN(teamOvertimeFourScore)){
				alert("输入有误");
				return;
			}
			data += "&teamOvertimeFourScore="+teamOvertimeFourScore;
			teamTotalScore += parseInt(teamOvertimeFourScore);
		}
		
		if(teamTwoOvertimeOneScore != null && teamTwoOvertimeOneScore != '' && teamTwoOvertimeOneScore != undefined){
			if(teamOvertimeOneScore == null || teamOvertimeOneScore == '' || teamOvertimeOneScore == undefined){
				alert("加时赛数据不一致");
				return;
			}
			if(isNaN(teamTwoOvertimeOneScore)){
				alert("输入有误");
				return;
			}
			data += "&teamTwoOvertimeOneScore="+teamTwoOvertimeOneScore;
			teamTwoTotalScore += parseInt(teamTwoOvertimeOneScore);
		}
		if(teamTwoOvertimeTwoScore != null && teamTwoOvertimeTwoScore != '' && teamTwoOvertimeTwoScore != undefined){
			if(teamOvertimeTwoScore == null || teamOvertimeTwoScore == '' || teamOvertimeTwoScore == undefined){
				alert("加时赛数据不一致");
				return;
			}
			if(isNaN(teamTwoOvertimeTwoScore)){
				alert("输入有误");
				return;
			}
			data += "&teamTwoOvertimeTwoScore="+teamTwoOvertimeTwoScore;
			teamTwoTotalScore += parseInt(teamTwoOvertimeTwoScore);
		}
		if(teamTwoOvertimeThreeScore != null && teamTwoOvertimeThreeScore != '' && teamTwoOvertimeThreeScore != undefined){
			if(teamOvertimeThreeScore == null || teamOvertimeThreeScore == '' || teamOvertimeThreeScore == undefined){
				alert("加时赛数据不一致");
				return;
			}
			if(isNaN(teamTwoOvertimeThreeScore)){
				alert("输入有误");
				return;
			}
			data += "&teamTwoOvertimeThreeScore="+teamTwoOvertimeThreeScore;
			teamTwoTotalScore += parseInt(teamTwoOvertimeThreeScore);
		}
		if(teamTwoOvertimeFourScore != null && teamTwoOvertimeFourScore != '' && teamTwoOvertimeFourScore != undefined){
			if(teamOvertimeFourScore == null || teamOvertimeFourScore == '' || teamOvertimeFourScore == undefined){
				alert("加时赛数据不一致");
				return;
			}
			if(isNaN(teamTwoOvertimeFourScore)){
				alert("输入有误");
				return;
			}
			data += "&teamTwoOvertimeFourScore="+teamTwoOvertimeFourScore;
			teamTwoTotalScore += parseInt(teamTwoOvertimeFourScore);
		}
		data += "&teamTotalScore="+teamTotalScore+"&teamTwoTotalScore="+teamTwoTotalScore;
		$.ajax({
			url:"/scoreManage/totalScoreAddOrUpdate.json",
			type:"POST",
			data:data,
			dataType:"JSON",
			success:function(data) {
				if(data){
					$("[name='"+teamId+"']").text(teamTotalScore);
					$("[name='"+teamTwoId+"']").text(teamTwoTotalScore);
					alert("保存成功");
				}else{
					alert("保存失败");
				}
	        }
		});
		
	});
	
	$(".team-date-btn").click(function(){
		var parent = $(this).parent();
		var shootBasketHitTotal = parent.find("[name='shootBasketHitTotal']").val();
		var shootBasketTotal = parent.find("[name='shootBasketTotal']").val();
		var twoPointsHitTotal = parent.find("[name='twoPointsHitTotal']").val();
		var twoPointsTotal = parent.find("[name='twoPointsTotal']").val();
		var threePointsHitTotal = parent.find("[name='threePointsHitTotal']").val();
		var threePointsTotal = parent.find("[name='threePointsTotal']").val();
		var freeThrowHitTotal = parent.find("[name='freeThrowHitTotal']").val();
		var freeThrowTotal = parent.find("[name='freeThrowTotal']").val();
		var assistsAsts = parent.find("[name='assistsAsts']").val();
		var frontBackboard = parent.find("[name='frontBackboard']").val();
		var backBackboard = parent.find("[name='backBackboard']").val();
		var backboard = parent.find("[name='backboard']").val();
		var fastScore = parent.find("[name='fastScore']").val();
		var capping = parent.find("[name='capping']").val();
		var steals = parent.find("[name='steals']").val();
		var foul = parent.find("[name='foul']").val();
		var fault = parent.find("[name='fault']").val();
		
		if(shootBasketHitTotal == null || shootBasketHitTotal == ""){
			alert("请填写投篮总命中");
			return;
		}else if(isNaN(shootBasketHitTotal)){
			alert("投篮总命中只能为数字");
			return;
		}
		if(shootBasketTotal == null || shootBasketTotal == ""){
			alert("请填写总投篮");
			return;
		}else if(isNaN(shootBasketTotal)){
			alert("总投篮只能为数字");
			return;
		}
		if(twoPointsHitTotal == null || twoPointsHitTotal == ""){
			alert("请填写2分总命中");
			return;
		}else if(isNaN(twoPointsHitTotal)){
			alert("2分总命中只能为数字");
			return;
		}
		if(twoPointsTotal == null || twoPointsTotal == ""){
			alert("请填写2分总投篮");
			return;
		}else if(isNaN(twoPointsTotal)){
			alert("2分总投篮只能为数字");
			return;
		}
		if(threePointsHitTotal == null || threePointsHitTotal == ""){
			alert("请填写3分总命中");
			return;
		}else if(isNaN(threePointsHitTotal)){
			alert("3分总命中只能为数字");
			return;
		}
		if(threePointsTotal == null || threePointsTotal == ""){
			alert("请填写3分总投篮");
			return;
		}else if(isNaN(threePointsTotal)){
			alert("3分总投篮只能为数字");
			return;
		}
		if(freeThrowHitTotal == null || freeThrowHitTotal == ""){
			alert("请填写罚球总数");
			return;
		}else if(isNaN(freeThrowHitTotal)){
			alert("罚球总数只能为数字");
			return;
		}
		if(freeThrowTotal == null || freeThrowTotal == ""){
			alert("请填写罚球总命中数");
			return;
		}else if(isNaN(freeThrowTotal)){
			alert("罚球总命中数只能为数字");
			return;
		}
		if(assistsAsts == null || assistsAsts == ""){
			alert("请填写助攻数");
			return;
		}else if(isNaN(assistsAsts)){
			alert("助攻数只能为数字");
			return;
		}
		if(frontBackboard == null || frontBackboard == ""){
			alert("请填写进攻篮板数");
			return;
		}else if(isNaN(frontBackboard)){
			alert("进攻篮板数只能为数字");
			return;
		}
		if(backBackboard == null || backBackboard == ""){
			alert("请填写防守篮板数");
			return;
		}else if(isNaN(backBackboard)){
			alert("防守篮板数只能为数字");
			return;
		}
		if(backboard == null || backboard == ""){
			alert("请填写总篮板数");
			return;
		}else if(isNaN(backboard)){
			alert("总篮板数只能为数字");
			return;
		}
		if(fastScore == null || fastScore == ""){
			alert("请填写快速得分");
			return;
		}else if(isNaN(fastScore)){
			alert("快速得分只能为数字");
			return;
		}
		if(capping == null || capping == ""){
			alert("请填写盖帽数");
			return;
		}else if(isNaN(capping)){
			alert("盖帽数只能为数字");
			return;
		}
		if(steals == null || steals == ""){
			alert("请填写抢断数");
			return;
		}else if(isNaN(steals)){
			alert("抢断数只能为数字");
			return;
		}
		if(foul == null || foul == ""){
			alert("请填写犯规数");
			return;
		}else if(isNaN(foul)){
			alert("犯规数只能为数字");
			return;
		}
		if(fault == null || fault == ""){
			alert("请填写失误数");
			return;
		}else if(isNaN(fault)){
			alert("失误数只能为数字");
			return;
		}
		$("[name='teamForm']").submit();
	});
	
	$(".team-two-date-btn").click(function(){
		var parent = $(this).parent();
		var shootBasketHitTotal = parent.find("[name='shootBasketHitTotal']").val();
		var shootBasketTotal = parent.find("[name='shootBasketTotal']").val();
		var twoPointsHitTotal = parent.find("[name='twoPointsHitTotal']").val();
		var twoPointsTotal = parent.find("[name='twoPointsTotal']").val();
		var threePointsHitTotal = parent.find("[name='threePointsHitTotal']").val();
		var threePointsTotal = parent.find("[name='threePointsTotal']").val();
		var freeThrowHitTotal = parent.find("[name='freeThrowHitTotal']").val();
		var freeThrowTotal = parent.find("[name='freeThrowTotal']").val();
		var assistsAsts = parent.find("[name='assistsAsts']").val();
		var frontBackboard = parent.find("[name='frontBackboard']").val();
		var backBackboard = parent.find("[name='backBackboard']").val();
		var backboard = parent.find("[name='backboard']").val();
		var fastScore = parent.find("[name='fastScore']").val();
		var capping = parent.find("[name='capping']").val();
		var steals = parent.find("[name='steals']").val();
		var foul = parent.find("[name='foul']").val();
		var fault = parent.find("[name='fault']").val();
		
		if(shootBasketHitTotal == null || shootBasketHitTotal == ""){
			alert("请填写投篮总命中");
			return;
		}else if(isNaN(shootBasketHitTotal)){
			alert("投篮总命中只能为数字");
			return;
		}
		if(shootBasketTotal == null || shootBasketTotal == ""){
			alert("请填写总投篮");
			return;
		}else if(isNaN(shootBasketTotal)){
			alert("总投篮只能为数字");
			return;
		}
		if(twoPointsHitTotal == null || twoPointsHitTotal == ""){
			alert("请填写2分总命中");
			return;
		}else if(isNaN(twoPointsHitTotal)){
			alert("2分总命中只能为数字");
			return;
		}
		if(twoPointsTotal == null || twoPointsTotal == ""){
			alert("请填写2分总投篮");
			return;
		}else if(isNaN(twoPointsTotal)){
			alert("2分总投篮只能为数字");
			return;
		}
		if(threePointsHitTotal == null || threePointsHitTotal == ""){
			alert("请填写3分总命中");
			return;
		}else if(isNaN(threePointsHitTotal)){
			alert("3分总命中只能为数字");
			return;
		}
		if(threePointsTotal == null || threePointsTotal == ""){
			alert("请填写3分总投篮");
			return;
		}else if(isNaN(threePointsTotal)){
			alert("3分总投篮只能为数字");
			return;
		}
		if(freeThrowHitTotal == null || freeThrowHitTotal == ""){
			alert("请填写罚球总数");
			return;
		}else if(isNaN(freeThrowHitTotal)){
			alert("罚球总数只能为数字");
			return;
		}
		if(freeThrowTotal == null || freeThrowTotal == ""){
			alert("请填写罚球总命中数");
			return;
		}else if(isNaN(freeThrowTotal)){
			alert("罚球总命中数只能为数字");
			return;
		}
		if(assistsAsts == null || assistsAsts == ""){
			alert("请填写助攻数");
			return;
		}else if(isNaN(assistsAsts)){
			alert("助攻数只能为数字");
			return;
		}
		if(frontBackboard == null || frontBackboard == ""){
			alert("请填写进攻篮板数");
			return;
		}else if(isNaN(frontBackboard)){
			alert("进攻篮板数只能为数字");
			return;
		}
		if(backBackboard == null || backBackboard == ""){
			alert("请填写防守篮板数");
			return;
		}else if(isNaN(backBackboard)){
			alert("防守篮板数只能为数字");
			return;
		}
		if(backboard == null || backboard == ""){
			alert("请填写总篮板数");
			return;
		}else if(isNaN(backboard)){
			alert("总篮板数只能为数字");
			return;
		}
		if(fastScore == null || fastScore == ""){
			alert("请填写快速得分");
			return;
		}else if(isNaN(fastScore)){
			alert("快速得分只能为数字");
			return;
		}
		if(capping == null || capping == ""){
			alert("请填写盖帽数");
			return;
		}else if(isNaN(capping)){
			alert("盖帽数只能为数字");
			return;
		}
		if(steals == null || steals == ""){
			alert("请填写抢断数");
			return;
		}else if(isNaN(steals)){
			alert("抢断数只能为数字");
			return;
		}
		if(foul == null || foul == ""){
			alert("请填写犯规数");
			return;
		}else if(isNaN(foul)){
			alert("犯规数只能为数字");
			return;
		}
		if(fault == null || fault == ""){
			alert("请填写失误数");
			return;
		}else if(isNaN(fault)){
			alert("失误数只能为数字");
			return;
		}
		$("[name='teamTwoForm']").submit();
	});
	
	$("#teamForm").validate( {
        submitHandler : function(form) {
            $("#teamForm").ajaxSubmit(function(date,res,me){
                if(date){
                    alert("保存成功了！");
                }else{
                	alert("修改失败了！");
                }
            });
        },
        highlight: function (e) {
            $(e).closest('.control-group').removeClass('info').addClass('error');
        }
    });
	
	$("#teamTwoForm").validate( {
        submitHandler : function(form) {
            $("#teamTwoForm").ajaxSubmit(function(date,res,me){
                if(date){
                    alert("保存成功了！");
                }else{
                	alert("修改失败了！");
                }
            });
        },
        highlight: function (e) {
            $(e).closest('.control-group').removeClass('info').addClass('error');
        }
    });
	
	$(".player-date-btn").click(function(){
		var parent = $(this).parent().parent();
		var playingTime = parent.find("[name='playingTime']").val();
		var freeThrowTotal = parent.find("[name='freeThrowTotal']").val();
		var freeThrowHitTotal = parent.find("[name='freeThrowHitTotal']").val();
		var freeThrowHitRate = percentNum(freeThrowHitTotal,freeThrowTotal);		//罚球命中率
		parent.find("[name='freeThrowHitRate']").text(freeThrowHitRate+"%");
		var twoPointsTotal = parent.find("[name='twoPointsTotal']").val();
		var twoPointsHitTotal = parent.find("[name='twoPointsHitTotal']").val();
		var twoPointsHitRate = percentNum(twoPointsHitTotal,twoPointsTotal);		//两分命中率
		parent.find("[name='twoPointsHitRate']").text(twoPointsHitRate+"%");
		var threePointsTotal = parent.find("[name='threePointsTotal']").val();
		var threePointsHitTotal = parent.find("[name='threePointsHitTotal']").val();
		var threePointsHitRate = percentNum(threePointsHitTotal,threePointsTotal);	//三分命中率
		parent.find("[name='threePointsHitRate']").text(threePointsHitRate+"%");
		var frontBackboard = parent.find("[name='frontBackboard']").val();
		var backBackboard = parent.find("[name='backBackboard']").val();
		var backboard = parent.find("[name='backboard']").val();
		var assistsAsts = parent.find("[name='assistsAsts']").val();
		var steals = parent.find("[name='steals']").val();
		var capping = parent.find("[name='capping']").val();
		var fault = parent.find("[name='fault']").val();
		var foul = parent.find("[name='foul']").val();
		var totalScore = parent.find("[name='totalScore']").val();
		var totalRate = parent.find("[name='totalRate']").val();
		
		if(playingTime == null || playingTime ==''){
			alert("请填写时间");
			return;
		}else if(isNaN(playingTime)){
			alert("时间只能为数字");
			return;
		}
		if(freeThrowTotal == null || freeThrowTotal ==''){
			alert("请填写罚球总数");
			return;
		}else if(isNaN(freeThrowTotal)){
			alert("罚球总数只能为数字");
			return;
		}
		if(freeThrowHitTotal == null || freeThrowHitTotal ==''){
			alert("请填写罚球命中数");
			return;
		}else if(isNaN(freeThrowHitTotal)){
			alert("罚球命中数只能为数字");
			return;
		}
		if(twoPointsTotal == null || twoPointsTotal ==''){
			alert("请填写2分投篮总数");
			return;
		}else if(isNaN(twoPointsTotal)){
			alert("2分投篮总数只能为数字");
			return;
		}
		if(twoPointsHitTotal == null || twoPointsHitTotal ==''){
			alert("请填写2分投篮命中数");
			return;
		}else if(isNaN(twoPointsHitTotal)){
			alert("2分投篮命中数只能为数字");
			return;
		}
		if(threePointsTotal == null || threePointsTotal ==''){
			alert("请填写3分投篮总数");
			return;
		}else if(isNaN(threePointsTotal)){
			alert("3分投篮总数只能为数字");
			return;
		}
		if(threePointsHitTotal == null || threePointsHitTotal ==''){
			alert("请填写3分命中数");
			return;
		}else if(isNaN(threePointsHitTotal)){
			alert("3分命中数只能为数字");
			return;
		}
		if(frontBackboard == null || frontBackboard ==''){
			alert("请填写前场篮板");
			return;
		}else if(isNaN(frontBackboard)){
			alert("前场篮板只能为数字");
			return;
		}
		if(backBackboard == null || backBackboard ==''){
			alert("请填写后场篮板");
			return;
		}else if(isNaN(backBackboard)){
			alert("后场篮板只能为数字");
			return;
		}
		if(backboard == null || backboard ==''){
			alert("请填写篮板总数");
			return;
		}else if(isNaN(backboard)){
			alert("篮板总数只能为数字");
			return;
		}
		if(assistsAsts == null || assistsAsts ==''){
			alert("请填写助攻数");
			return;
		}else if(isNaN(assistsAsts)){
			alert("助攻数只能为数字");
			return;
		}
		if(steals == null || steals==''){
			alert("请填写抢断数");
			return;
		}else if(isNaN(steals)){
			alert("抢断数只能为数字");
			return;
		}
		if(capping == null || capping ==''){
			alert("请填写封盖数");
			return;
		}else if(isNaN(capping)){
			alert("封盖数只能为数字");
			return;
		}
		if(fault == null || fault ==''){
			alert("请填写失误数");
			return;
		}else if(isNaN(fault)){
			alert("失误数只能为数字");
			return;
		}
		if(foul == null || foul ==''){
			alert("请填写犯规数");
			return;
		}else if(isNaN(foul)){
			alert("犯规数只能为数字");
			return;
		}
		if(totalScore == null || totalScore ==''){
			alert("请填写总得分");
			return;
		}else if(isNaN(totalScore)){
			alert("总得分只能为数字");
			return;
		}
		if(totalRate == null || totalRate ==''){
			alert("请填写总命中率");
			return;
		}else if(isNaN(totalRate)){
			alert("总命中率只能为数字");
			return;
		}
		var playerId = $(this).attr("id");
		var contestId = $("#contestId").val();
		var seasonId = $("#seasonId").val();
		var teamId = parent.find("[name='teamId']").val();
		var competitor = parent.find("[name='competitor']").val();
		
		var data = "playerId="+playerId+"&contestId="+contestId+"&teamId="+teamId+
					"&seasonId="+seasonId+"&playingTime="+playingTime+"&competitor="+competitor+
					"&freeThrowTotal="+freeThrowTotal+"&freeThrowHitTotal="+freeThrowHitTotal+
					"&freeThrowHitRate="+freeThrowHitRate+"&twoPointsTotal="+twoPointsTotal+
					"&twoPointsHitTotal="+twoPointsHitTotal+"&twoPointsHitRate="+twoPointsHitRate+
					"&threePointsTotal="+threePointsTotal+"&threePointsHitTotal="+threePointsHitTotal+
					"&threePointsHitRate="+threePointsHitRate+"&frontBackboard="+frontBackboard+
					"&backBackboard="+backBackboard+"&backboard="+backboard+
					"&assistsAsts="+assistsAsts+"&steals="+steals+
					"&capping="+capping+"&fault="+fault+
					"&foul="+foul+"&totalScore="+totalScore+"&totalRate="+totalRate;
		
		$.ajax({
			url:"/scoreManage/playerDateAddOrUpdate.json",
			type:"POST",
			data:data,
			dataType:"JSON",
			success:function(data) {
				if(data){
					alert("保存成功");
				}else{
					alert("保存失败");
				}
	        }
		});
	});
});

function percentNum(num, num2) { 
	if(isNaN(num) || isNaN(num2) || num == 0 || num2 == 0){
		return 0;
	}
    return (Math.round(num / num2 * 10000) / 100.00); //小数点后两位百分比
}